Update examples sub-repo#119
Conversation
✅ Deploy Preview for react-datocms-example ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Replaced with the Vite version at /index.html
| return ( | ||
| <div className="example" data-title="Full-blown example"> | ||
| <Helmet>{renderMetaTags(metaTags)}</Helmet> | ||
| {renderMetaTags(metaTags)} |
There was a problem hiding this comment.
React 19 should support this now: https://react.dev/blog/2024/12/05/react-19#support-for-metadata-tags
There was a problem hiding this comment.
I regenerated the whole thing from scratch to make sure we have no orphans in it
| "eject": "react-scripts eject" | ||
| "start": "vite", | ||
| "build": "vite build", | ||
| "setup": "echo 'Setup is no longer necessary in this version, skipping...'" |
There was a problem hiding this comment.
We can also modify the Netlify build command to remove this step
| "@datocms/cma-client-browser": "^5.2.1", | ||
| "react": "^19.2.3", | ||
| "react-datocms": "^7.2.4", | ||
| "react-dom": "^19.2.3", |
There was a problem hiding this comment.
It is better to more realistically include it from npm, I think, for people who don't want to build the whole monorepo (parent repo) and just want to use the examples. The setup step and file-based transclusion is kinda messy....
| base: './', | ||
| plugins: [react()], | ||
| build: { | ||
| outDir: "build", |
There was a problem hiding this comment.
This has to be explicitly specified for backward compatibility with react-script's default folder
|
Thanks for the fix 🙏 if you're taking suggestions, there's also what looks like a debugging line left in the image examples: react-datocms/examples/src/ImageExamples/index.jsx Lines 52 to 60 in 4412919
|
Not sure what that's about... 🤷 Removed it for now in 5320502, but @stefanoverna may add it back if there's a good reason for it? |

Fix #118
The examples page was no longer rendering.
This updates it to use the latest React version and Vite instead of react-scripts.
Works again after the update: https://deploy-preview-119--react-datocms-example.netlify.app/